import serial.tools.list_ports

port_list = list(serial.tools.list_ports.comports())
if len(port_list) == 0:
    print('无可用串口')
else:
    for i in port_list:
        print(i.device)
        print()
